package net.chasing.androidbaseconfig.widget.dialog;

import android.content.Context;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.permissionx.guolindev.dialog.RationaleDialog;

import net.chasing.androidbaseconfig.R;
import net.chasing.androidbaseconfig.databinding.DialogPermissionTipsBinding;

import java.util.Collections;
import java.util.List;

public class PermissionTipsDialog extends RationaleDialog {

    private DialogPermissionTipsBinding mBinding;

    private List<String>  mPermissionList;

    public PermissionTipsDialog(@NonNull Context context) {
        super(context);
        initView();
    }

    private void  initView(){
        View view = View.inflate(getContext(), R.layout.dialog_permission_tips, null);
        mBinding = DataBindingUtil.bind(view);
        setContentView(view);

        mBinding.close.setVisibility(View.GONE);

        setCanceledOnTouchOutside(false);
        setCancelable(false);
    }

    @NonNull
    @Override
    public View getPositiveButton() {
        return mBinding.sure;
    }

    @Nullable
    @Override
    public View getNegativeButton() {
        return mBinding.cancel;
    }

    @NonNull
    @Override
    public List<String> getPermissionsToRequest() {
        return mPermissionList;
    }

    public void setTips(String tips) {
        mBinding.message.setText(tips);
    }

    public void setPermissionList(List<String> permissionList) {
        mPermissionList = permissionList;
    }

    public void setLeftText(String text) {
        mBinding.cancel.setText(text);
    }

    public void setRightText(String text) {
        mBinding.sure.setText(text);
    }
}
